" vim:ft=vim

Execute(test-FloatermFirst-FloatermLast):
  FloatermNew
  let bufnr1 = bufnr('%')
  FloatermNew
  let bufnr2 = bufnr('%')
  FloatermNew
  let bufnr3 = bufnr('%')
  FloatermNew
  let bufnr4 = bufnr('%')

  Log '# Execute `:FloatermFirst`'
    FloatermFirst
    AssertEqual bufnr1, bufnr('%')

  Log '# Execute `:FloatermLast`'
    FloatermLast
    AssertEqual bufnr4, bufnr('%')

  Log '# Kill the first floaterm and execute `:FloatermFirst`'
    FloatermHide " otherwise vim8 testing fails
    execute bufnr1 . 'FloatermKill'
    FloatermFirst
    AssertEqual bufnr2, bufnr('%')

  Log '# Kill the last floaterm and execute `:FloatermLast`'
    FloatermHide " otherwise vim8 testing fails
    execute bufnr4 . 'FloatermKill'
    FloatermLast
    AssertEqual bufnr3, bufnr('%')

  FloatermKill!
  stopinsert
